
/******************************************************************************\
|    Title:        	 FIGURE5: Average marginal effects of being a switcher on  |
|					 log lobbying revenue, by year since leaving Congress      |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000


use lobbyist_yearly.dta, clear

reg log_adjlobrev_wgt i.switcher##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)

margins if yearsinceleaving<8, dydx(i.switcher) over(i.yearsinceleaving)

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) ytitle("Effect estimate for being a switcher") title("") xtitle("Year since leaving Congress") 

** for substantive interpretation
reg log_adjlobrev_wgt i.switcher##i.yearsinceleaving experience_imp daysworked committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear log_max_adjannual_pay i.year if posttreat==1, cluster(stafferid)
margins switcher if yearsinceleaving<8, over(i.yearsinceleaving)